using System;
using System.Runtime.Serialization;
using System.Security.Permissions;

namespace OracleInternal.SqlAndPlsqlParser.LocalParsing
{
	[Serializable]
	public class OracleLpException : ApplicationException, ISerializable
	{
		protected OracleLpExceptionType m_vType;

		protected OracleLpExceptionError m_vError;

		public OracleLpExceptionType Type => m_vType;

		public OracleLpExceptionError Error => m_vError;

		public OracleLpException(OracleLpExceptionType type, OracleLpExceptionError error)
		{
			m_vType = type;
			m_vError = error;
		}

		public OracleLpException(OracleLpExceptionType type, OracleLpExceptionError error, string message)
			: base(message)
		{
			m_vType = type;
			m_vError = error;
		}

		public OracleLpException(OracleLpExceptionType type, OracleLpExceptionError error, string message, Exception innerException)
			: base(message, innerException)
		{
			m_vType = type;
			m_vError = error;
		}

		protected OracleLpException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			uint num = (uint)(m_vType = (OracleLpExceptionType)info.GetUInt32("Type"));
			num = (uint)(m_vError = (OracleLpExceptionError)info.GetUInt32("Error"));
		}

		public override string ToString()
		{
			return $"Type: {m_vType.ToString()}\nError: {m_vError.ToString()}\nMessage: {base.ToString()}";
		}

		[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			base.GetObjectData(info, context);
			info.AddValue("Type", (uint)m_vType);
			info.AddValue("Error", (uint)m_vError);
		}
	}
}
